home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Sound / MUImp3 / MUICDID.mcd < prev    next >
Text File  |  2000-04-30  |  4KB  |  185 lines

  1. /* */
  2.  
  3. address MUICDID
  4. options results
  5.  
  6. parse arg name
  7.  
  8. option = word(name,1)
  9. target = substr(name,length(option)+2)
  10. prefs = 'envarc:MUImp3.prefs'
  11. pref = 'envarc:MUICDID.prefs'
  12. sorted = -3
  13. sorten = -1
  14. true = 1
  15. false = 0
  16.  
  17.  call open('work',prefs,'R')
  18.  do a = 1 to 13
  19.   line.a = readln('work')
  20.  end
  21.  call close('work')
  22. if ~show('L',"rexxtricks.library") then call addlib('rexxtricks.library',0,-30,0)
  23.  
  24. if option="INIT" then do
  25.  call open('work',pref,'R')
  26.  aacdb=readln('work')
  27.  acddb=readln('work')
  28.  call close('work')
  29.  address MUICDID
  30.  popasl id acdb content aacdb
  31.  string id cddb content acddb
  32.  address command
  33.  'rx MUICDID.mcd GETID'
  34.  exit
  35. end
  36.  
  37. if option="GETCDDB" then do
  38.  address MUICDID
  39.  popasl id acdb
  40.  aacdb=result
  41.  string id cddb
  42.  acddb=result
  43.  if aacdb="" then aacdb='ACDB'
  44.  if aacdb='RESULT' then aacdb='ACDB'
  45.  if acddb="" then acddb='sj.ca.us.cddb.com'
  46.  if acddb='RESULT' then acddb='sj.ca.us.cddb.com'
  47.  call open('work',pref,'W')
  48.  call writeln('work',aacdb)
  49.  call writeln('work',acddb) 
  50.  call close('work')
  51.  popasl id acdb content aacdb
  52.  string id cddb content acddb
  53.  address command
  54.  cc=aacdb 'device='||line.1 'unit='||line.2 'host='||acddb 'disks='||line.13
  55.  'run >nil:' cc
  56.  'waitforport ACDB'
  57.  address ACDB
  58.  'CDID DOWNLOAD'
  59.  'QUIT'
  60.  address command
  61.  'rx MUICDID.mcd GETID'
  62. exit
  63. end
  64.  
  65. if option="SAVE" then do
  66.  address MUICDID
  67.  text id cdid
  68.  file=result
  69.  if file="" then exit
  70.  call open('work',makepath(line.13,file),'W')
  71.  string id title
  72.  call writeln('work',result)
  73.  string id arti
  74.  call writeln('work',result)
  75.  list id titel attrs 0x80421654
  76.  nr = result
  77.  list id titel
  78.  do a = 0 to nr-2
  79.   list id titel pos a
  80.   call writeln('work',result)
  81.  end
  82.  call close('work')
  83. exit
  84. end
  85.  
  86.  
  87. if option="GETID" then do
  88.  file = "ID"
  89.  temp = maketemp('t:')
  90.  address command
  91.  'cdda mute list' line.3 '>'||temp
  92.  if rc>0 then exit
  93.  call open('work',temp,'R')
  94.  a = 0
  95.  do until eof('work')
  96.   a = a + 1
  97.   track.a = readln('work')
  98.  end
  99.  call close('work')
  100.  'delete >nil:' temp
  101.  nr = a - 3
  102.  file = file||overlay(nr,'00',3-length(nr))||'0'
  103.  if nr > 1 then do 
  104.   file1 = d2x(value(word(track.2,6))+value(word(track.3,6)))
  105.  if word(track.2,2)>0 then file1 = d2x(value(word(track.2,6))+value(word(track.3,6)+value(word(track.2,2))))
  106.   if length(file1)<5 then file1=overlay(file1,'00000',6-length(file1))
  107.  end
  108.  else file1 = '00000'
  109.  file = file||file1||'0'
  110.  a = nr + 2
  111.  file1 = d2x(value(word(track.a,6)))
  112.  if word(track.2,2)>0 then file1 = d2x(value(word(track.2,2)+word(track.a,6)))
  113.  file = file||file1
  114.  address MUICDID
  115.  text id cdid label file
  116.  if exists(makepath(line.13,file)) then do
  117.   call open('work',makepath(line.13,file),'R')
  118.   a = 0
  119.   do until eof('work')
  120.    a = a + 1
  121.    targ.a = readln('work')
  122.   end
  123.   call close('work')
  124.   targ.0 = a - 1
  125.   address MUICDID
  126.   string id title content targ.1
  127.   string id arti content targ.2
  128.   address command
  129.   'rx MUICDID.mcd CLEAR'
  130.   address MUICDID
  131.   do a = 3 to targ.0
  132.    list id titel insert pos sorted string targ.a
  133.   end
  134.    list id titel insert pos sorted string "--End of Line--"
  135.  end
  136.  else do
  137.   call open('work',makepath(line.13,file),'W')
  138.   nr = value(substr(file,3,2))
  139.   call writeln('work','Unknown')
  140.   call writeln('work',file)
  141.   do a = 1 to nr
  142.    call writeln('work',file||'-'||overlay(a,00,3-length(a)))
  143.   end
  144.   call close('work')
  145.   address command
  146.   'rx MUICDID.mcd GETID'
  147.  end
  148.  exit
  149. end
  150.  
  151. if option='REPLACE' then do
  152. address MUICDID
  153. list id titel
  154. nr = result
  155. list id titel remove string nr
  156. list id titel insert pos sorten string target
  157. list id titel
  158. nr = result
  159. list id titel
  160. string id song content nr
  161. string id song
  162. exit
  163. end
  164.  
  165. if option='CLEAR' then do
  166.  address MUICDID
  167.  list id titel string ""
  168. exit
  169. end
  170.  
  171. exit
  172.  
  173.  
  174. maketemp:
  175. parse arg path
  176. a = 1
  177. temp = makepath(path,'MUICDID.1.tmp')
  178. do while exists(temp)
  179. a = a + 1
  180. temp = makepath(path,'MUICDID.'a'.tmp')
  181. end
  182. call open('work',temp,'W')
  183. call close('work')
  184. return temp
  185.